package com.yanqu.road.entity.grandchild;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.DataStatus;

@FieldTypeAnnotation(tableName = "t_c_grand_child_champion")
public class GrandChildChampion extends DataObject {

    @FieldTypeAnnotation(desc = "区服ID", select = true, update = true)
    private long serverId;
    @FieldTypeAnnotation(desc = "玩家ID", update = true)
    private long userId;
    @FieldTypeAnnotation(desc = "状元数量")
    private long count;
    @FieldTypeAnnotation(desc = "更新时间")
    private long updateTime;

    public void changeCount(long count) {
        synchronized (this) {
            this.count += count;
            this.updateTime = System.currentTimeMillis();
            setUpdateOption();
        }
    }

    // ==================================================================

    public long getServerId() {
        return serverId;
    }

    public void setServerId(long serverId) {
        if (this.serverId != serverId) {
            this.serverId = serverId;
            setOp(DataStatus.Update);
        }
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setOp(DataStatus.Update);
        }
    }

    public long getCount() {
        return count;
    }

    public void setCount(long count) {
        if (this.count != count) {
            this.count = count;
            setOp(DataStatus.Update);
        }
    }

    public long getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(long updateTime) {
        if (this.updateTime != updateTime) {
            this.updateTime = updateTime;
            setOp(DataStatus.Update);
        }
    }
}
